fix(web): stop modals closing on backdrop click - #326
Conversation
An accidental click on the dimmed backdrop no longer discards in-progress credential setup. Backdrop dismissal is now opt-in via a new dismissOnBackdrop prop (default true) on the shared Modal, and the credential modal opts out.
Backdrop-click-to-close is now off by default across every modal (Escape and the X/Cancel buttons still close them), broadening the earlier credential-only fix per reviewer request.
|
| Filename | Overview |
|---|---|
| web/src/components/Modal.tsx | Adds opt-in dismissOnBackdrop prop (default false), changing the outer wrapper's onClick from always-onClose to conditionally undefined. The existing stopPropagation on the card keeps the opt-in path safe; Escape-key close is intentionally preserved. |
Reviews (1): Last reviewed commit: "fix(web): disable backdrop-click dismiss..." | Re-trigger Greptile
Requested by Jake Hulberg · Slack thread
Summary
Clicking the dimmed backdrop outside a modal was closing it, discarding any in-progress work. This makes backdrop-dismiss off by default for every modal in the app, broadening the earlier credential-only fix per reviewer request.
Before: clicking the dimmed backdrop outside ANY modal closed it, discarding in-progress work (credential setup, service setup, etc.).
After: an outside/backdrop click no longer closes any modal. Modals close via the X button, Cancel, or Escape. This applies app-wide.
How: flipped the shared
web/src/components/Modal.tsxdismissOnBackdropdefault tofalse(the opt-in prop is retained for any modal that wants backdrop-dismiss back). The always-rendered header X button plus per-modal Cancel/Escape guarantee every modal stays closeable. Dropdown menus are unaffected — they use a separate pattern and intentionally keep outside-click-to-close.Type of change
Test plan
make test) — not run; change is frontend-onlyFrontend build verified with
npm ci && npm run build(tsc && vite build) — compiles cleanly. Manual check: clicking the backdrop no longer closes any modal; the X, Cancel, and Escape still close them.Security checklist
Generated by Claude Code